<template>
  <a-spin :spinning="confirmLoading">
    <!-- 子标签页 -->
    <a-tabs :activeKey="labelPageKey" @change="handleTabBeforeChange">
      <a-tab-pane tab="发泡" key="tab1" :forceRender="true">
        <j-form-container :disabled="formDisabled">
          <!-- 主表单区域 -->
          <a-form :form="form" slot="detail">
            <a-row>
              <!-- <a-col :span="12" >
            <a-form-item label="P/O" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input v-decorator="['orderNum']" placeholder="请输入P/O" ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="12" >
            <a-form-item label="发票号" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input v-decorator="['invoiceNum']" placeholder="请输入发票号" ></a-input>
            </a-form-item>
          </a-col> 
          <a-col :span="12" >
            <a-form-item label="出货地址" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input v-decorator="['shippingAddress']" placeholder="请输入出货地址" ></a-input>
            </a-form-item> 
          </a-col> -->
              <a-col :span="12">
                <a-form-item label="批次号" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input v-decorator="['batchNumber']" placeholder="请输入批次号"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="入库日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-date placeholder="请选择入库日期" v-decorator="['inOrderDate']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="到货方式" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag type="list" v-decorator="['sourceOfGoods']" :trigger-change="true"
                    dictCode="source_of_goods" placeholder="请选择到货方式" @change="handleSourceOfGoodsChange" />
                </a-form-item>
              </a-col>
              <a-col :span="24">
                <a-form-item label="集装箱号" :labelCol="{ span: 3 }" :wrapperCol="{ span: 18 }"
                  v-show="this.container === '1' || this.model.sourceOfGoods===1">
                  <a-input v-decorator="['containerNo']" placeholder="请输入集装箱号"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="铅封号" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="this.container === '1' || this.model.sourceOfGoods===1">
                  <a-input v-decorator="['sealNum']" placeholder="请输入铅封号"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="国别" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="this.container === '1' || this.model.sourceOfGoods===1">
                  <a-input v-decorator="['nationality']" placeholder="请输入国别"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="司机姓名" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="this.bus === '2' || this.model.sourceOfGoods===2">
                  <a-input v-decorator="['driverName']" placeholder="请输入司机姓名"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="车牌号" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="this.bus === '2' || this.model.sourceOfGoods===2">
                  <a-input v-decorator="['busNum']" placeholder="请输入车牌号"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="货品种类" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag type="list" v-decorator="['skuType']" :trigger-change="true" dictCode="sku_type"
                    placeholder="请选择货品种类" />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="客户编码" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input v-decorator="['customerCode']" placeholder="请输入客户编码"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="总托数" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input-number v-decorator="['trayNum']" placeholder="请输入总托数" style="width: 100%" />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="总箱数" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input-number v-decorator="['boxNum']" placeholder="请输入总箱数" style="width: 100%" />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="总数量" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input-number v-decorator="['pcsNum']" placeholder="请输入总数量" style="width: 100%" />
                </a-form-item>
              </a-col>
              <!-- <a-col :span="12" >
            <a-form-item label="入库类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-dict-select-tag type="list" v-decorator="['inOrderType']" :trigger-change="true" dictCode="in_order_type" placeholder="请选择入库类型" />
            </a-form-item>
          </a-col> -->
              <!-- <a-col :span="12" >
            <a-form-item label="入库状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-dict-select-tag type="list" v-decorator="['inOrderStatus']" :trigger-change="true" dictCode="order_status" placeholder="请选择入库状态" />
            </a-form-item>
          </a-col> -->
              <!-- <a-col :span="12" >
            <a-form-item label="是否挂起" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-switch v-decorator="['isHangUp']" checked-children="是" un-checked-children="否" @change="onIsHangUp"></j-switch>
            </a-form-item>
          </a-col> -->
              <a-col :span="12">
                <a-form-item label="挂起人" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="model.isHangUp === 1">
                  <a-input v-decorator="['hangUpMan']" placeholder="请输入挂起人" disabled></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="挂起时间" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="model.isHangUp === 1">
                  <j-date placeholder="请选择挂起时间" v-decorator="['hangUpTime']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="解挂人" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="model.isHangUp === 0">
                  <a-input v-decorator="['hangSoluMan']" placeholder="请输入解挂人" disabled></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="解挂时间" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="model.isHangUp === 0">
                  <j-date placeholder="请选择解挂时间" v-decorator="['hangSoluTime']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="理货员" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input v-decorator="['tallyClerk']" placeholder="请输入理货员" disabled></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="理货时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-date placeholder="请选择理货时间" v-decorator="['tallyClerkTime']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="叉车司机" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input v-decorator="['truckDriver']" placeholder="请输入叉车司机" disabled></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="上架时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-date placeholder="请选择上架时间" v-decorator="['truckTime']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled />
                </a-form-item>
              </a-col>
            </a-row>
          </a-form>
        </j-form-container>
      </a-tab-pane>

      <a-tab-pane tab="进口" key="tab2" :forceRender="true">
        <!-- 子标签2的字段 -->
        <j-form-container :disabled="formDisabled">
          <!-- 主表单区域 -->
          <a-form :form="form" slot="detail">
            <a-row>
              <a-col :span="12">
                <a-form-item label="入库日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-date placeholder="请选择入库日期" v-decorator="['inOrderDate']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="到货方式" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag type="list" v-decorator="['sourceOfGoods']" :trigger-change="true"
                    dictCode="source_of_goods" placeholder="请选择到货方式" @change="handleSourceOfGoodsChange" />
                </a-form-item>
              </a-col>
              <a-col :span="24">
                <a-form-item label="集装箱号" :labelCol="{ span: 3 }" :wrapperCol="{ span: 18 }"
                  v-show="this.container === '1' || this.model.sourceOfGoods===1">
                  <a-input v-decorator="['containerNo']" placeholder="请输入集装箱号"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="铅封号" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="this.container === '1' || this.model.sourceOfGoods===1">
                  <a-input v-decorator="['sealNum']" placeholder="请输入铅封号"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="国别" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="this.container === '1' || this.model.sourceOfGoods===1">
                  <a-input v-decorator="['nationality']" placeholder="请输入国别"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="司机姓名" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="this.bus === '2' || this.model.sourceOfGoods===2">
                  <a-input v-decorator="['driverName']" placeholder="请输入司机姓名"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="车牌号" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="this.bus === '2' || this.model.sourceOfGoods===2">
                  <a-input v-decorator="['busNum']" placeholder="请输入车牌号"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="货品种类" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag type="list" v-decorator="['skuType']" :trigger-change="true" dictCode="sku_type"
                    placeholder="请选择货品种类" />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="客户编码" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input v-decorator="['customerCode']" placeholder="请输入客户编码"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="总托数" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input-number v-decorator="['trayNum']" placeholder="请输入总托数" style="width: 100%" />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="总箱数" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input-number v-decorator="['boxNum']" placeholder="请输入总箱数" style="width: 100%" />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="总数量" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input-number v-decorator="['pcsNum']" placeholder="请输入总数量" style="width: 100%" />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="挂起人" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="model.isHangUp === 1">
                  <a-input v-decorator="['hangUpMan']" placeholder="请输入挂起人" disabled></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="挂起时间" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="model.isHangUp === 1">
                  <j-date placeholder="请选择挂起时间" v-decorator="['hangUpTime']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="解挂人" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="model.isHangUp === 0">
                  <a-input v-decorator="['hangSoluMan']" placeholder="请输入解挂人" disabled></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="解挂时间" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="model.isHangUp === 0">
                  <j-date placeholder="请选择解挂时间" v-decorator="['hangSoluTime']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="理货员" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input v-decorator="['tallyClerk']" placeholder="请输入理货员" disabled></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="理货时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-date placeholder="请选择理货时间" v-decorator="['tallyClerkTime']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="叉车司机" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input v-decorator="['truckDriver']" placeholder="请输入叉车司机" disabled></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="上架时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-date placeholder="请选择上架时间" v-decorator="['truckTime']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled />
                </a-form-item>
              </a-col>
            </a-row>
          </a-form>
        </j-form-container>
      </a-tab-pane>

      <a-tab-pane tab="出口" key="tab3" :forceRender="true">
        <!-- 子标签3的字段 -->
        <j-form-container :disabled="formDisabled">
          <!-- 主表单区域 -->
          <a-form :form="form" slot="detail">
            <a-row>
              <a-col :span="12">
                <a-form-item label="P/O" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input v-decorator="['orderNum']" placeholder="请输入P/O"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="发票号" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input v-decorator="['invoiceNum']" placeholder="请输入发票号"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="出货地址" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <!-- <a-textarea v-decorator="['shippingAddress']" placeholder="请输入出货地址" style="display: inline-block;"></a-textarea> -->
                  <a-input v-decorator="['shippingAddress']" placeholder="请输入出货地址"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="批次号" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input v-decorator="['batchNumber']" placeholder="请输入批次号"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="入库日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-date placeholder="请选择入库日期" v-decorator="['inOrderDate']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="到货方式" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag type="list" v-decorator="['sourceOfGoods']" :trigger-change="true"
                    dictCode="source_of_goods" placeholder="请选择到货方式" @change="handleSourceOfGoodsChange" />
                </a-form-item>
              </a-col>
              <a-col :span="24">
                <a-form-item label="集装箱号" :labelCol="{ span: 3 }" :wrapperCol="{ span: 18 }"
                  v-show="this.container === '1' || this.model.sourceOfGoods===1">
                  <a-input v-decorator="['containerNo']" placeholder="请输入集装箱号"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="铅封号" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="this.container === '1' || this.model.sourceOfGoods===1">
                  <a-input v-decorator="['sealNum']" placeholder="请输入铅封号"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="国别" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="this.container === '1' || this.model.sourceOfGoods===1">
                  <a-input v-decorator="['nationality']" placeholder="请输入国别"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="司机姓名" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="this.bus === '2' || this.model.sourceOfGoods===2">
                  <a-input v-decorator="['driverName']" placeholder="请输入司机姓名"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="车牌号" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="this.bus === '2' || this.model.sourceOfGoods===2">
                  <a-input v-decorator="['busNum']" placeholder="请输入车牌号"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="货品种类" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag type="list" v-decorator="['skuType']" :trigger-change="true" dictCode="sku_type"
                    placeholder="请选择货品种类" />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="客户编码" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input v-decorator="['customerCode']" placeholder="请输入客户编码"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="总托数" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input-number v-decorator="['trayNum']" placeholder="请输入总托数" style="width: 100%" />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="总箱数" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input-number v-decorator="['boxNum']" placeholder="请输入总箱数" style="width: 100%" />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="总数量" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input-number v-decorator="['pcsNum']" placeholder="请输入总数量" style="width: 100%" />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="挂起人" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="model.isHangUp === 1">
                  <a-input v-decorator="['hangUpMan']" placeholder="请输入挂起人" disabled></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="挂起时间" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="model.isHangUp === 1">
                  <j-date placeholder="请选择挂起时间" v-decorator="['hangUpTime']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="解挂人" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="model.isHangUp === 0">
                  <a-input v-decorator="['hangSoluMan']" placeholder="请输入解挂人" disabled></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="解挂时间" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="model.isHangUp === 0">
                  <j-date placeholder="请选择解挂时间" v-decorator="['hangSoluTime']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="理货员" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input v-decorator="['tallyClerk']" placeholder="请输入理货员" disabled></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="理货时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-date placeholder="请选择理货时间" v-decorator="['tallyClerkTime']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="叉车司机" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input v-decorator="['truckDriver']" placeholder="请输入叉车司机" disabled></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="上架时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-date placeholder="请选择上架时间" v-decorator="['truckTime']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled />
                </a-form-item>
              </a-col>
              <a-col :span="12" v-show="false">
                <a-form-item label="入库单类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <a-input v-decorator="['inOrderType']" placeholder="请输入入库单类型" disabled></a-input>
                </a-form-item>
              </a-col>
            </a-row>
          </a-form>
        </j-form-container>
      </a-tab-pane>
      <a-tab-pane tab="DICH" key="tab4" :forceRender="true">
        <!-- 子标签4的字段 -->
        <j-form-container :disabled="formDisabled">
          <!-- 主表单区域 -->
          <a-form :form="form" slot="detail">
            <a-row>
              <a-col :span="12">
                <a-form-item label="P/O" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input v-decorator="['orderNum']" placeholder="请输入P/O"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="发票号" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input v-decorator="['invoiceNum']" placeholder="请输入发票号"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="出货地址" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <!-- <a-textarea v-decorator="['shippingAddress']" placeholder="请输入出货地址" style="display: inline-block;"></a-textarea> -->
                  <a-input v-decorator="['shippingAddress']" placeholder="请输入出货地址"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="批次号" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input v-decorator="['batchNumber']" placeholder="请输入批次号"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="入库日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-date placeholder="请选择入库日期" v-decorator="['inOrderDate']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="到货方式" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag type="list" v-decorator="['sourceOfGoods']" :trigger-change="true"
                    dictCode="source_of_goods" placeholder="请选择到货方式" @change="handleSourceOfGoodsChange" />
                </a-form-item>
              </a-col>
              <a-col :span="24">
                <a-form-item label="集装箱号" :labelCol="{ span: 3 }" :wrapperCol="{ span: 18 }"
                  v-show="this.container === '1' || this.model.sourceOfGoods===1">
                  <a-input v-decorator="['containerNo']" placeholder="请输入集装箱号"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="铅封号" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="this.container === '1' || this.model.sourceOfGoods===1">
                  <a-input v-decorator="['sealNum']" placeholder="请输入铅封号"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="国别" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="this.container === '1' || this.model.sourceOfGoods===1">
                  <a-input v-decorator="['nationality']" placeholder="请输入国别"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="司机姓名" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="this.bus === '2' || this.model.sourceOfGoods===2">
                  <a-input v-decorator="['driverName']" placeholder="请输入司机姓名"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="车牌号" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="this.bus === '2' || this.model.sourceOfGoods===2">
                  <a-input v-decorator="['busNum']" placeholder="请输入车牌号"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="货品种类" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag type="list" v-decorator="['skuType']" :trigger-change="true" dictCode="sku_type"
                    placeholder="请选择货品种类" />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="客户编码" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input v-decorator="['customerCode']" placeholder="请输入客户编码"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="总托数" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input-number v-decorator="['trayNum']" placeholder="请输入总托数" style="width: 100%" />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="总箱数" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input-number v-decorator="['boxNum']" placeholder="请输入总箱数" style="width: 100%" />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="总数量" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input-number v-decorator="['pcsNum']" placeholder="请输入总数量" style="width: 100%" />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="挂起人" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="model.isHangUp === 1">
                  <a-input v-decorator="['hangUpMan']" placeholder="请输入挂起人" disabled></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="挂起时间" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="model.isHangUp === 1">
                  <j-date placeholder="请选择挂起时间" v-decorator="['hangUpTime']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="解挂人" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="model.isHangUp === 0">
                  <a-input v-decorator="['hangSoluMan']" placeholder="请输入解挂人" disabled></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="解挂时间" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="model.isHangUp === 0">
                  <j-date placeholder="请选择解挂时间" v-decorator="['hangSoluTime']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="理货员" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input v-decorator="['tallyClerk']" placeholder="请输入理货员" disabled></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="理货时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-date placeholder="请选择理货时间" v-decorator="['tallyClerkTime']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled />
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="叉车司机" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input v-decorator="['truckDriver']" placeholder="请输入叉车司机" disabled></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item label="上架时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-date placeholder="请选择上架时间" v-decorator="['truckTime']" :trigger-change="true" :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled />
                </a-form-item>
              </a-col>
              <a-col :span="12" v-show="false">
                <a-form-item label="入库单类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <a-input v-decorator="['inOrderType']" placeholder="请输入入库单类型" disabled></a-input>
                </a-form-item>
              </a-col>
            </a-row>
          </a-form>
        </j-form-container>
      </a-tab-pane>
    </a-tabs>
    <!-- 子表单区域 -->
    <a-tabs v-model="activeKey" @change="handleChangeTabs">
      <a-tab-pane tab="入库单子表" :key="refKeys[0]" :forceRender="true">
        <j-editable-table :ref="refKeys[0]" :loading="inOrderZiTable.loading" :columns="inOrderZiTable.columns"
          :dataSource="inOrderZiTable.dataSource" :maxHeight="300" :disabled="formDisabled" :rowNumber="true"
          :rowSelection="true" :actionButton="true">
          <template v-slot:action1="props">
            <div>
              <a-auto-complete v-model="props.value" :data-source="suggestions"
                @search="handleSearch(props, 'skuCode1', $event)" @select="handleSelect(props, 'skuCode1', $event)"
                placeholder="请输入品番编码"></a-auto-complete>
            </div>
          </template>
          <template v-slot:action2="props">
            <div>
              <a-auto-complete v-model="props.value" :data-source="suggestions"
                @search="handleSearch(props, 'skuCode2', $event)" @select="handleSelect(props, 'skuCode2', $event)"
                placeholder="请输入品番编码"></a-auto-complete>
            </div>
          </template>
        </j-editable-table>
      </a-tab-pane>
    </a-tabs>

    <a-row v-if="showFlowSubmitButton" style="text-align: center;width: 100%;margin-top: 16px;"><a-button
        @click="handleOk">提 交</a-button></a-row>
  </a-spin>
</template>

<script>

import pick from 'lodash.pick'
import { getAction, putAction } from '@/api/manage'
import { FormTypes, getRefPromise } from '@/utils/JEditableTableUtil'
import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
import { AutoComplete } from 'ant-design-vue';
import 'ant-design-vue/dist/antd.css';
import { VALIDATE_NO_PASSED, validateFormAndTables } from '@/utils/JEditableTableUtil'
import { validateDuplicateValue } from '@/utils/util'
import store from '@/store'

export default {
  name: 'InOrder1Form',
  mixins: [JEditableTableMixin],
  components: {
    [AutoComplete.name]: AutoComplete,
  },
  data() {
    return {
      suggestions: [],
      container: '',
      bus: '',
      labelPageKey: 'tab1',
      labelCol: {
        xs: { span: 24 },
        sm: { span: 6 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      labelCol2: {
        xs: { span: 24 },
        sm: { span: 3 },
      },
      wrapperCol2: {
        xs: { span: 24 },
        sm: { span: 20 },
      },
      // 新增时子表默认添加几行空数据
      addDefaultRowNum: 1,
      validatorRules: {
      },
      refKeys: ['inOrderZi',],
      tableKeys: ['inOrderZi',],
      activeKey: 'inOrderZi',
      // 入库单子表
      inOrderZiTable: {
        loading: false,
        dataSource: [],
        columns: [
          // {
          //   title: '父id',
          //   key: 'pid',
          //   type: FormTypes.input,
          //   width:"200px",
          //   placeholder: '请输入${title}',
          //   defaultValue:'',
          // },
          {
            title: '品番编码',
            key: 'skuCode1',
            type: FormTypes.slot,
            slotName: 'action1',
            dictCode: "",
            width: "200px",
            placeholder: '请输入${title}',
            defaultValue: '',
            validateRules: [{ required: true, message: '${title}不能为空' }],
          },
          {
            title: '品番编码2',
            key: 'skuCode2',
            type: FormTypes.slot,
            slotName: 'action2',
            width: "200px",
            placeholder: '请输入${title}',
            defaultValue: '',
          },
          {
            title: '生产日期',
            key: 'productionDate',
            type: FormTypes.datetime,
            width: "200px",
            placeholder: '请输入${title}',
            defaultValue: '',
          },
          // {
          //   title: '客户编码',
          //   key: 'customerCode',
          //   type: FormTypes.input,
          //   width: "200px",
          //   placeholder: '请输入${title}',
          //   defaultValue: '',
          // },
          {
            title: '托数',
            key: 'trayNum',
            type: FormTypes.inputNumber,
            width: "200px",
            placeholder: '请输入${title}',
            defaultValue: '',
            validateRules: [{ required: true, message: '${title}不能为空' }],
          },
          {
            title: '箱数/托',
            key: 'boxNum',
            type: FormTypes.inputNumber,
            width: "200px",
            placeholder: '请输入${title}',
            defaultValue: '',
            validateRules: [{ required: true, message: '${title}不能为空' }],
          },
          {
            title: '收容数/箱',
            key: 'pcs',
            type: FormTypes.inputNumber,
            width: "200px",
            placeholder: '请输入${title}',
            defaultValue: '',
            validateRules: [{ required: true, message: '${title}不能为空' }],
          },
          {
            title: '总件数',
            key: 'pcsNum',
            type: FormTypes.inputNumber,
            width: "200px",
            placeholder: '请输入${title}',
            defaultValue: '',
            disabled: true,
          },
          {
            title: '包装类型',
            key: 'packagingType',
            type: FormTypes.select,
            dictCode: "packaging_type",
            width: "200px",
            placeholder: '请输入${title}',
            defaultValue: '',
            validateRules: [{ required: true, message: '${title}不能为空' }],
          },
          {
            title: '状态',
            key: 'inOrderStatus',
            type: FormTypes.select,
            dictCode: "order_status",
            width: "200px",
            placeholder: '请输入${title}',
            defaultValue: '',
            disabled: true
          },
        ]
      },
      url: {
        add: "/inOrder1/inOrder1/add",
        edit: "/inOrder1/inOrder1/edit",
        queryById: "/inOrder1/inOrder1/queryById",
        inOrderZi: {
          list: '/inOrder1/inOrder1/queryInOrderZiByMainId'
        },
        getSkuDetail: "/basicSkuDetail/basicSkuDetail/getSkuDetail/",
      }
    }
  },
  props: {
    //流程表单data
    formData: {
      type: Object,
      default: () => { },
      required: false
    },
    //表单模式：false流程表单 true普通表单
    formBpm: {
      type: Boolean,
      default: false,
      required: false
    },
    //表单禁用
    disabled: {
      type: Boolean,
      default: false,
      required: false
    }
  },
  computed: {
    formDisabled() {
      if (this.formBpm === true) {
        if (this.formData.disabled === false) {
          return false
        }
        return true
      }
      return this.disabled
    },
    showFlowSubmitButton() {
      if (this.formBpm === true) {
        if (this.formData.disabled === false) {
          return true
        }
      }
      return false
    }
  },
  created() {
    //如果是流程中表单，则需要加载流程表单data
    this.showFlowData();
  },
  methods: {
    handleSearch(row, key, queryString) {
      //设置用户键入值
      if (key === 'skuCode1') {
        this.$refs.inOrderZi.setValues([{
          'rowKey': row.rowId, values: {
            'skuCode1': queryString
          }
        }]);
      } else if (key === 'skuCode2') {
        this.$refs.inOrderZi.setValues([{
          'rowKey': row.rowId, values: {
            'skuCode2': queryString
          }
        }]);
      }
      // 根据 queryString 查询匹配的品番编码数据
      getAction(this.url.getSkuDetail + queryString).then((res) => {
        if (res.success) {
          // 将查询结果赋值给 this.suggestions 数组
          this.suggestions = res.result;
        }
      }).catch((error) => {
        console.log(error);
      });
    },
    handleSelect(row, key, selectedItem) {
      console.log("处理用户选择的品番编码" + row + key + selectedItem);
      // 处理用户选择的品番编码
      if (key === 'skuCode1') {
        this.$refs.inOrderZi.setValues([{
          'rowKey': row.rowId, values: {
            'skuCode1': selectedItem
          }
        }]);
      } else if (key === 'skuCode2') {
        this.$refs.inOrderZi.setValues([{
          'rowKey': row.rowId, values: {
            'skuCode2': selectedItem
          }
        }]);
      }
    },
    handleOk() {
      if (this.labelPageKey == 'tab1') {
        this.form.setFieldsValue({
          'inOrderType': 1
        })
      } else if (this.labelPageKey == 'tab2') {
        this.form.setFieldsValue({
          'inOrderType': 2
        })
      } else if (this.labelPageKey == 'tab4') {
        this.form.setFieldsValue({
          'inOrderType': 4
        })
      } else {
        this.form.setFieldsValue({
          'inOrderType': 3
        })
      }
      /** 触发表单验证 */
      this.getAllTable().then(tables => {
        /** 一次性验证主表和所有的次表 */
        return validateFormAndTables(this.form, tables)
      }).then(allValues => {
        if (typeof this.classifyIntoFormData !== 'function') {
          throw this.throwNotFunction('classifyIntoFormData')
        }
        let formData = this.classifyIntoFormData(allValues)
        // 发起请求
        return this.request(formData)
      }).catch(e => {
        if (e.error === VALIDATE_NO_PASSED) {
          // 如果有未通过表单验证的子表，就自动跳转到它所在的tab
          this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index]
        } else {
          console.error(e)
        }
      })
    },
    // 到货方式选择调用
    handleSourceOfGoodsChange(value) {
      if (value === '1') {
        this.container = value;
        this.bus = '';
      } else if (value === '2') {
        this.bus = value;
        this.container = '';
      } else {
        this.container = '';
        this.bus = '';
      }
    },
    // 标签页切换调用
    handleTabBeforeChange(value) {
      if (this.form && !this.form.isFieldsTouched()) {
        // 获取表单所有字段的值
        const fieldsValue = this.form.getFieldsValue();
        // 判断表单是否有值
        if (Object.values(fieldsValue).some(value => value !== undefined && value !== '')) {
          // 表单有值，禁止切换标签
          return false;
        }
        // 表单未修改且无值，允许切换标签
        this.labelPageKey = value;
        return true;
      } else {
        // 表单已修改，禁止直接切换标签
        var result = confirm("切换标签会清空已有数据，是否继续？");
        if (result) {
          // 用户点击了确定按钮
          this.form.resetFields();
          this.labelPageKey = value;
          return true;
        } else {
          // 用户点击了取消按钮
          return false;
        }
      }
    },
    addBefore() {
      this.form.resetFields()
      this.inOrderZiTable.dataSource = []
    },
    getAllTable() {
      let values = this.tableKeys.map(key => getRefPromise(this, key))
      return Promise.all(values)
    },
    /** 调用完edit()方法之后会自动调用此方法 */
    editAfter() {
      let fieldval = pick(this.model, 'orderNum', 'invoiceNum', 'shippingAddress', 'batchNumber', 'inOrderDate', 'sourceOfGoods', 'containerNo', 'sealNum', 'nationality', 'driverName', 'busNum', 'skuType', 'customerCode', 'trayNum', 'boxNum', 'pcsNum', 'inOrderType', 'inOrderStatus', 'isHangUp', 'hangUpMan', 'hangUpTime', 'hangSoluMan', 'hangSoluTime', 'tallyClerk', 'tallyClerkTime', 'truckDriver', 'truckTime')
      this.$nextTick(() => {
        this.form.setFieldsValue(fieldval)
        if (this.model.inOrderType===2) {
          this.labelPageKey = 'tab2';
        }else if (this.model.inOrderType===3) {
          this.labelPageKey = 'tab3';
        }else if (this.model.inOrderType===4) {
          this.labelPageKey = 'tab4';
        }else{
          this.labelPageKey = 'tab1';
        }
      })
      // 加载子表数据
      if (this.model.id) {
        let params = { id: this.model.id }
        this.requestSubTableData(this.url.inOrderZi.list, params, this.inOrderZiTable)
      }
    },
    /** 整理成formData */
    classifyIntoFormData(allValues) {
      let main = Object.assign(this.model, allValues.formValue)
      return {
        ...main, // 展开
        inOrderZiList: allValues.tablesValue[0].values,
      }
    },
    //渲染流程表单数据
    showFlowData() {
      if (this.formBpm === true) {
        let params = { id: this.formData.dataId };
        getAction(this.url.queryById, params).then((res) => {
          if (res.success) {
            this.edit(res.result);
          }
        })
      }
    },
    validateError(msg) {
      this.$message.error(msg)
    },
    popupCallback(row) {
      this.form.setFieldsValue(pick(row, 'orderNum', 'invoiceNum', 'shippingAddress', 'batchNumber', 'inOrderDate', 'sourceOfGoods', 'containerNo', 'sealNum', 'nationality', 'driverName', 'busNum', 'skuType', 'customerCode', 'trayNum', 'boxNum', 'pcsNum', 'inOrderType', 'inOrderStatus', 'isHangUp', 'hangUpMan', 'hangUpTime', 'hangSoluMan', 'hangSoluTime', 'tallyClerk', 'tallyClerkTime', 'truckDriver', 'truckTime'))
    },

  }
}
</script>

<style scoped></style>